package com.webPageReader;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;

import org.jsoup.Jsoup;

public class testClass {
	public static void main(String[] args) {
		try {
			URL google = new URL ("http://open.mapquestapi.com/directions/v2/route?key=Fmjtd%7Cluurn908nd%2C70%3Do5-9wtlda&ambiguities=ignore&from=1717+SW+Park+ave+portland+OR&to=Pioneer+Square+Portland+Or&callback=renderNarrative&outFormat=xml");
			BufferedReader in = new BufferedReader(new InputStreamReader(google.openStream()));
			String inputLine;
			StringBuilder stringHtml = new StringBuilder();
			while((inputLine = in.readLine()) != null) {
				//process each line 
				stringHtml.append(inputLine);
				//System.out.println(inputLine);
			}
			in.close();
			org.jsoup.nodes.Document html = Jsoup.parse(stringHtml.toString());
			String h1 = html.body().getElementsByTag("formattedTime").text();
			System.out.println(h1);
			System.out.println(h1.substring(0, 8));
		} catch (MalformedURLException me) {
			System.out.println(me);
		} catch (IOException ioe) {
			// TODO: handle exception
			System.out.println(ioe);
		}
		
	} // end main

}
